import { API } from '../api'
import { CydonElement, define } from 'cydon'
import '@cydon/ui/components/CAsync'

/**
 * @element dash-board
 * 仪表盘组件
 */
@define('dash-board')
export class DashBoard extends CydonElement {
	getTotalTagCount = API.getTotalTagCount

	getTotalDailyView = API.getTotalDailyView

	getAvgTagCount = API.getAvgTagCount

	/** 标签总数 */
	async getTotalTag() {
		const [r] = await API.getTag(void 0, void 0, void 0, 0)
		return r
	}

	/** 图片总数 */
	async getTotalPost() {
		const [r] = await API.search(void 0, void 0, void 0, void 0, 0)
		return r
	}

	/** 用户总数 */
	async getTotalUser() {
		const [r] = await API.getUserInfo(void 0, void 0, void 0, 0)
		return r
	}
}

declare global {
	interface HTMLElementTagNameMap {
		'dash-board': DashBoard
	}
}